﻿using System;
using System.ServiceModel;

namespace RemoteWorker.NantTask
{
    public class ServerConnection : DuplexClientBase<IWorkerManager>, IWorkerManager
    {
        public ServerConnection(INantTask callbackInstance) : base(callbackInstance)
        {
            InnerDuplexChannel.OperationTimeout = TimeSpan.FromHours(1);
            InnerDuplexChannel.AutomaticInputSessionShutdown = true;
        }

        public void Execute(string workerName, string fileName, string args)
        {
            Channel.Execute(workerName, fileName, args);
        }

        public bool CheckWorker(string workerName)
        {
            return Channel.CheckWorker(workerName);
        }
    }
}